package code;

/**
 * Instruction description for our virtual machine.
 */
public enum Opcode {
	// Arithmetic
	ADD ,
	SUB ,
	AND ,
	OR ,
	XOR ,
	SHIFTL ,
	SHIFTR ,
	MUL ,
	DIV ,
	GDIV ,
	MOD	,
	ADDC ,
	SUBC ,

	// Comparison and logical operations
	EQUAL ,
	NOTEQUAL ,
	LESS ,
	LESSEQUAL ,
	GREATER ,
	GREATEREQUAL ,
	SEL ,

	// Load and Store local variables and constants
	LOAD ,
	STORE ,
	LDIC ,
	LDDC {public boolean needsInteger() {return false;} },

	// Control flow
	JUMP ,
	JZ ,

	// I/O instruction
	WRITEINT ,
	WRITECHAR ,
	WRITEDOUBLE ,
	WRITEBOOL ,
	READINT ,
	READDOUBLE ,
	READCHAR ,
	
	// Special instruction for Methods and Objects
	CALLMETH ,
	GETVALUE ,
	SETVALUE ,
	NEW ,
	RETURN ,
	RETURNVALUE ,
	LENGTH ,
	
	// Special
	INTTOBOOL ,
	DUP ,
	HALT ,
	;
	
	public boolean needsInteger() {
		return true;
	}
}

